package name.huzhenbo.java.patterns.singleton;

/**
 * This approach is functionally equivalent to the public field approach, except that
 * 1. it is more concise,
 * 2. provides the serialization machinery for free,
 * 3. and provides an ironclad guarantee against multiple instantiation, even in the face of sophisticated serialization or reflection attacks.
 * <p/>
 * While this approach has yet to be widely adopted, a single-element enum type is the best way to implement a singleton.
 */
public enum EnumSingleton {
    INSTANCE;

    private String[] favoriates = {"first", "second", "third"};

    public String[] getFavoriates() {
        return favoriates;
    }

    public void doSomeThing() {
        // implmenetation omited
    }
}
